using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MCromwell.StaffIntranet.DTO;

namespace MCromwell.StaffIntranet.UI
{
    public partial class ErrorHighlighter : UserControl
    {
        private string displayText = "*";
        private string errorId = string.Empty;
        private string cssClass = "error-highlighter";
               
        public string CssClass
        {
            get { return cssClass; }
            set { cssClass = value; }
        }
                
        public string ErrorId
        {
            get { return errorId; }
            set { errorId = value; }
        }

        public string DisplayText
        {
            get { return displayText; }
            set { displayText = value; }
        }
                
        protected void Page_Load(object sender, EventArgs e)
        {
            lblDisplayText.CssClass = cssClass;
        }
                
        public void CheckNotification(NotificationDTO notification)
        {
            if (notification.HasErrors)
            {
                if (notification.ErrorExists(errorId))
                {
                    lblDisplayText.ToolTip = notification.GetError(errorId).Message;
                    lblDisplayText.Text = displayText;
                }
            }
        }
                
    }
}